package gjtx8;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Save {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        SimpleDateFormat df=new SimpleDateFormat("hh:mm:ss");
        Date d=new Date();
        try {
            BufferedWriter w=new BufferedWriter(new FileWriter("D:\\新建文件夹\\java10/4.txt",true));
            System.out.println("请输入：");
            while (true){
                String sr=in.nextLine();
                if (!sr.equals("quit")) {
                    String dfs = df.format(d.getTime());
                    w.write(dfs+" "+sr);
                    w.newLine();
                }else {
                    w.close();
                    break;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
